package com.kaifamiao.demo.d0804;

import java.util.Arrays;

public class Demo {

    public static void main(String[] args) {
        String str = "青蛙:孤寡~";

        char ch = str.charAt(0);

        System.out.println(ch);

        int code = str.codePointAt(0);
        System.out.println(code);
        code = str.codePointAt(1);
        System.out.println(code);

        int code1 = str.codePointBefore(2);
        System.out.println(code1);
        int[] codes = {38738, 34521};
        String str1 = new String(codes, 0, 2);
        System.out.println(str1);

        int num = "aB".compareTo("ab");
        num = "aB".compareToIgnoreCase("ab");
        System.out.println(num);

        // str1 = str + ", 祝福你"
        str1 = str.concat(", 祝福你");
        System.out.println(str1);

        boolean flag = str.contains("孤呱");
        System.out.println(flag);


        flag = "abc".contentEquals("abcd");
        System.out.println(flag);

        flag = "1111@163.com".endsWith(".com");
        System.out.println(flag);
        flag = str.startsWith("蛙");
        System.out.println(flag);

        char[] chs = new char[3];
        str.getChars(0, 2, chs, 1);

        System.out.println(Arrays.toString(chs));

        str1 = str.indent(2);
        System.out.println(str1);

        // (char) 97 --> a
        int index = "abadaeafag".indexOf(97);
        index = "abadaeafag".indexOf('a',3);
        System.out.println(index);

        index = str.indexOf("孤寡");
        System.out.println(index);

        System.out.println(" ".isBlank());
        System.out.println(" ".isEmpty());

        flag = "123a456".matches("^\\d{3}\\w{4}");
        System.out.println(flag);


        str1 = "6".repeat(10);
        System.out.println(str1);

        str1 = "abcadeabc".replace("ab", "A");
        System.out.println(str1);

        str1 = "1a2b3c4d".replaceAll("\\d{1}", "*");
        System.out.println(str1);

        // 转义 \ (转义字符)进行转义 \n  \t  "\""
        String s = "青蛙：\"呱\" \\";
        System.out.println(s);

        String s1 = """
                青蛙："呱呱呱"
                """;
        System.out.println(s1);

        s = "青蛙：\"呱\"";
        System.out.println(s);
    }
}
